package com.example.demo.controller;

import com.example.demo.model.Dbtypes;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author shkstart
 * @create 2023-02-15-23:32
 */
@Controller
@RequestMapping("/hi")//路由映射
public class HelloController {

    //读取配置文件，使用@value（“${xxx”）
    //xxx是配置信息中的前半部分
    @Value("${myconfig.sayhi}")
    private String str;

    @Autowired
    private Student student;

    @Autowired
    private Dbtypes dbtypes;

    @RequestMapping("/index")//路由映射
    @ResponseBody//返回一个非静态页面的数据
    public String sayHi(){

        return "你好，"+dbtypes;
    }

}
